namespace AbpCqrsTest.Commands
{
	using System.Threading;
	using System.Threading.Tasks;

	using Abp.Domain.Uow;

	using AbpPlus.Bus;
	using AbpPlus.Commands;
	using AbpPlus.Events;

	using MediatR;

	/// <summary>
	/// The hello world command 2 handler.
	/// </summary>
	public class HelloWorldCommand2Handler : CommandHandler, ICommandHandler<HelloWorldCommand2, HelloWorldCommandResponse>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="HelloWorldCommand2Handler"/> class.
		/// </summary>
		/// <param name="uow">
		/// The uow.
		/// </param>
		/// <param name="bus">
		/// The bus.
		/// </param>
		/// <param name="notifications">
		/// The notifications.
		/// </param>
		public HelloWorldCommand2Handler(
			IUnitOfWorkManager uow,
			IMediatorHandler bus,
			INotificationHandler<DomainNotification> notifications)
			: base(uow, bus, notifications)
		{
		}

		/// <summary>
		/// The handle.
		/// </summary>
		/// <param name="request">
		/// The request.
		/// </param>
		/// <param name="cancellationToken">
		/// The cancellation token.
		/// </param>
		/// <returns>
		/// The <see cref="Task"/>.
		/// </returns>
		public async Task<HelloWorldCommandResponse> Handle(HelloWorldCommand2 request, CancellationToken cancellationToken)
		{
			var response = new HelloWorldCommandResponse() { Name = "Hi," + request.Name };
			return await Task.FromResult(response);
		}
	}
}